package lamer;

import irio.gamer.gamer;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import Logic.Galaxy;

public class InputFrame extends JPanel {

	JLabel lblFilename = new JLabel();
	private int returnVal;
	
	
	public JPanel filePanel() {
		JPanel p = new JPanel();
		p.setLayout(new GridLayout(3,1));
		p.add(lblFilename);
		lblFilename.setText("FILE");
		JButton btnLoad = new JButton("Load");
		p.add(btnLoad);
		btnLoad.addActionListener(new ActionListener() {
			
			public void actionPerformed(ActionEvent arg0) {
					final JFileChooser fc = new JFileChooser("*.fits");
					//fc.setCurrentDirectory(new File(gamer.gamerParams.galaxyDir));
					fc.addActionListener(new ActionListener() {

						public void actionPerformed(ActionEvent e) {
							// TODO Auto-generated method stub
							if (returnVal == JFileChooser.APPROVE_OPTION
									&& fc.getSelectedFile() != null) {
								//gamer.reload(fc.getSelectedFile().getName());
								
							}
						}
					});
					returnVal = fc.showOpenDialog(gamer.galaxyPanel);

				}

		});
		return p;
	}	
 }
